package com.yunnuo.system.users.dao;

import com.yunnuo.system.users.entity.UserRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by w_weihf on 2018/7/20.
 */
@Repository
@Transactional
public interface IUserRoleDao extends JpaRepository<UserRole,String> {

    /**
     * 根据角色ID 查询是否已分配用户
     * @param roleId
     * @return
     */
    List findAllByRoleId(String roleId);

    void deleteByUserId(String userID);

    /**
     * 保存用户权限
     * @param userRole
     * @return
     */
    @Override
    UserRole  save(UserRole userRole);

}
